#!/bin/sh

#
# Established return
#


#
#
#



redir_local_port=8380
SERVER_SET=server_set

#
# ALL redirect
#

iptables -t nat -N SHADOWSOCKS_O

#### server road ####
iptables -t nat -I SHADOWSOCKS_O -p tcp   -d 47.52.242.79             -j RETURN
#iptables -t nat -I SHADOWSOCKS_O -m set   --match-set $SERVER_SET dst  -p tcp  -j RETURN

#### report api ####
iptables -t nat -I SHADOWSOCKS_O -p tcp   -d shadowfog.com            -j RETURN

#### external ip api ####
iptables -t nat -I SHADOWSOCKS_O -p tcp   -d api.ipify.org            -j RETURN
iptables -t nat -I SHADOWSOCKS_O -p tcp   -d ipinfo.io                -j RETURN
iptables -t nat -I SHADOWSOCKS_O -p tcp   -d myexternalip.com         -j RETURN
iptables -t nat -I SHADOWSOCKS_O -p tcp   -d gitee.com                -j RETURN


iptables -t nat -I SHADOWSOCKS_O -m state --state ESTABLISHED,RELATED -j RETURN

iptables -t nat -A SHADOWSOCKS_O -p tcp -j REDIRECT --to-ports $redir_local_port
iptables -t nat -I OUTPUT        -p tcp -j SHADOWSOCKS_O

